package com.lancoo.znbkxx.teacher.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.lancoo.znbkxx.teacher.R
import com.lancoo.znbkxx.teacher.model.data.ValidStu
import kotlinx.android.synthetic.main.item_stuname.view.*

class StuNameAdapter(data: MutableList<ValidStu>) : BaseQuickAdapter<ValidStu, BaseViewHolder>(data) {
    init {
        mLayoutResId = R.layout.item_stuname
    }

    override fun convert(helper: BaseViewHolder, item: ValidStu?) {
        with(helper.itemView) {
            tv_name.text = item?.StuName
            tv_name.isChecked=item!!.Checked
            if (item.Checked) {
                iv_stuName.setBackgroundResource(R.mipmap.icon_stuname_bg_select)
            } else {
                iv_stuName.setBackgroundResource(R.mipmap.icon_stuname_bg_unselect)
            }
        }
    }
}